# Python 2.6.4
# Project Euler, Problem 205
# Copyright 2010 Talha Zaman

def d(num, sides):
    if num==1:
        return [0] + [1] * sides
    count = [0] * (num*sides + 1)
    next = d(num-1, sides)
    for i in xrange(1, sides+1):
        for j in xrange(1, len(next)):
            count[i+j] += next[j]
    return count
    
def beats(d1, d2):
    wins = 0
    for i in xrange(len(d1)):
        wins += d1[i] * sum(d2[:i])
    return float(wins) / float(sum(d1) * sum(d2))

print beats(d(9,4), d(6,6))
